package com.aj.http.response;

import org.json.JSONException;
import org.json.JSONObject;

import com.aj.databases.entry.BabyInfo;

public class QueryBabyResponse extends BaseRespond {

	private BabyInfo babyInfo = new BabyInfo();

	public QueryBabyResponse(JSONObject json) {
		super(json);
		try {
			JSONObject resultJSONJsonObject = common.getResult();
			if (resultJSONJsonObject != null) {
				if (!resultJSONJsonObject.isNull("userId")) {
					babyInfo.setUserId(resultJSONJsonObject.getString("userId"));
				}
				if (!resultJSONJsonObject.isNull("babyNo")) {
					babyInfo.setBabyNo(resultJSONJsonObject.getString("babyNo"));
				}
				if (!resultJSONJsonObject.isNull("nickName")) {
					babyInfo.setNickName(resultJSONJsonObject
							.getString("nickName"));
				}
				if (!resultJSONJsonObject.isNull("conceptionDate")) {
					babyInfo.setConceptionDate(resultJSONJsonObject
							.getString("conceptionDate"));
				}
				if (!resultJSONJsonObject.isNull("bornDate")) {
					babyInfo.setBornDate(resultJSONJsonObject
							.getString("bornDate"));
				}
				if (!resultJSONJsonObject.isNull("photo")) {
					babyInfo.setPhoto(resultJSONJsonObject.getString("photo"));
				}
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}

	public BabyInfo getBabyInfo() {
		return babyInfo;
	}

	public void setBabyInfo(BabyInfo babyInfo) {
		this.babyInfo = babyInfo;
	}

}
